package com.example.gbasedemo.control;

import com.example.gbasedemo.mapper.TradeBaseDetailPojo;
import com.example.gbasedemo.service.ServiceTradeBase;
import com.example.gbasedemo.service.ServiceTradeBaseDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TradeBaseDetailControl {

    @Autowired
    private ServiceTradeBaseDetail service;

    @GetMapping("tbd/create")
    public String create1() {
        service.createTable();
        return "success";
    }

    @GetMapping("tbd/insert")
    public String insert() {
        service.insert();
        return "success";
    }

    @GetMapping("tbd/insert_rows")
    public String insertRows() {
        service.insertRows();
        return "success";
    }

    @GetMapping("tbd/update")
    public String update() {
        service.updateRow();
        return "success";
    }

    @GetMapping("tbd/delete")
    public String delete() {
        service.deleteRow();
        return "success";
    }

    @GetMapping("tbd/select")
    public TradeBaseDetailPojo select() {
        TradeBaseDetailPojo pojo = service.selectRow();
        return pojo;
    }

}
